from django.http import HttpResponse, HttpResponseRedirect
from django.template import Template, RequestContext
from django.shortcuts import render_to_response
from django.contrib.auth.decorators import login_required
import logging

logger = logging.getLogger("django")

def categories(request, start, offset):
    try:
        start = int(start)
        offset = int(offset)
    except ValueError:
        raise Http404()
    content = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
    line = "<categories>\n"
    content += line
    for i in range(offset):
    	j = start + i;
    	line = "    <phrasecat catid=\"" + str(j) + "\">Kategoria %s</phrasecat>\n" % (j)
    	content += line
    content += "</categories>\n"
    return HttpResponse(content, mimetype="application/xml")

